import { createApp } from "vue";
import "./style.css";
import ElementPlus from "element-plus";
import { baidu } from "./utils/system/statistics";
import "element-plus/theme-chalk/display.css"; // 引入基于断点的隐藏类
import "element-plus/dist/index.css";
import "normalize.css"; // css初始化
import "./assets/style/common.scss"; // 公共css
import "./theme/modules/chinese/index.scss";
import App from "./App.vue";
import store from "./store";
import router from "./router";
import { getAuthRoutes } from "./router/permission";
import i18n from "./locale";
// 自定义水印
import WaterMarker from "@/directive/waterMarker";
// vue2 中的事件总线
import mitt from "mitt";
if (import.meta.env.MODE !== "development") {
  // 非开发环境调用百度统计
  baidu();
}

import VXETable from "vxe-table";
import "vxe-table/lib/style.css";

// 注册全局权限指令
import Permission from "@/directive/permission";

function useTable(app: any) {
  app.use(VXETable);
}

/** 权限路由处理主方法 */
getAuthRoutes();

const app = createApp(App);
app.use(useTable);
app.directive("waterMarker", WaterMarker);
app.directive("Permission", Permission);
app.use(ElementPlus, { size: store.state.app.elementSize });
app.config.globalProperties.$bus = mitt();
app.use(store);
app.use(router);
app.use(i18n);
// app.config.performance = true
app.mount("#app");
